package tc.crase.db;

import tc.crase.sys.XdbEx;
import tc.crase.sys.XdbRoot;

public class XattrGIT extends Xattr {
	static private int maxid = 1;
	
	private int id;
	
	private XattrGRP group = null;
	private AttrId groupId;
	
	private Xobject parent;
		
	public XattrGIT(int id, int gid, String gidUrl, Xobject parent) {
		super("gitem");
		
		if (id < 0) {
			this.id = parent.db.maxLinkId++; 
		}
		else {
			//this.id = id;
			this.id = id;
			//if (maxid < id )maxid = id+1;
			if ( parent.db.maxLinkId <= id ) parent.db.maxLinkId = id+1;   
		}
		
		this.parent = parent; 
		this.groupId = new AttrId(gid, gidUrl);
	}
	
	public Xobject getParent() {
		return parent;
	}
	
	public int getId() {
		return id;
	}
	
	public AttrId getGId() {
		return groupId;
	}
	
	public XattrGRP getGroup() {
		return (XattrGRP)groupId.searchAttr(parent.getDb());
	}
	
	@Override
	public String getValue() {
		return "UNKNOWN"; 
	}
}
